package cn.niit.letuseatdemo.service.impl;


import cn.niit.letuseatdemo.entity.domain.Rating;
import cn.niit.letuseatdemo.mapper.RatingMapper;
import cn.niit.letuseatdemo.service.RatingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 评论Service业务层处理
 * 
 * @author 陆品贤
 * @date 2022-10-20
 */
@Service
public class RatingServiceImpl implements RatingService
{
    @Autowired
    private RatingMapper ratingMapper;

    /**
     * 根据评论id查询评论
     * 
     * @param ratingId 评论主键
     * @return 评论
     */
    @Override
    public Rating selectRatingByRatingId(Integer ratingId)
    {
        return ratingMapper.selectRatingByRatingId(ratingId);
    }



    /**
     * 根据菜品id查询评论
     *
     * @param
     * @return 评论
     */
    @Override
    public List<Rating> selectRatingByGoodsId(Long goodsId) {
        return ratingMapper.selectRatingByGoodsId(goodsId);
    }


    /**
     * 查询评论列表
     * 
     * @param rating 评论
     * @return 评论
     */
    @Override
    public List<Rating> selectRatingList(Rating rating)
    {
        return ratingMapper.selectRatingList(rating);
    }

    /**
     * 新增评论
     * 
     * @param rating 评论
     * @return 结果
     */
    @Override
    public int insertRating(Rating rating)
    {
        return ratingMapper.insertRating(rating);
    }

    /**
     * 修改评论
     * 
     * @param rating 评论
     * @return 结果
     */
    @Override
    public int updateRating(Rating rating)
    {
        return ratingMapper.updateRating(rating);
    }

    /**
     * 批量删除评论
     * 
     * @param ratingIds 需要删除主键
     * @return
     */
    @Override
    public int deleteRatingByRatingIds(String ratingIds)
    {
        return 0;
    }

    /**
     * 删除评论信息
     * 
     * @param ratingId 评论主键
     * @return 结果
     */
    @Override
    public int deleteRatingByRatingId(Integer ratingId)
    {
        return ratingMapper.deleteRatingByRatingId(ratingId);
    }
}
